<template>
  <div :class="['checkbox', { checkActive: value }]">
    <div
      class="box"
      @click="change"
      :style="{ width: width + 'px', height: width + 'px' }"
    >
      <div
        class="blurDiv"
        v-if="value"
        :style="{ width: width * 0.5 + 'px', height: width * 0.5 + 'px' }"
      ></div>
    </div>
    <slot></slot>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Boolean,
      default: false,
    },
    width: {
      type: Number,
      default: 12,
    },
  },
  methods: {
    change() {
      this.$emit("input", !this.value);
    },
  },
};
</script>

<style lang="scss" scoped>
.checkbox {
  display: flex;
  align-items: center;
}
.checkActive {
  color: #3a6ea5;
}
.box {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #b5b5b5;
  margin-right: 6px;
  .blurDiv {
    background-color: #3a6ea5;
  }
}
</style>
